if (!file_tree_walk (root, hardlink_split_path, 0, &hardlink_parent, error))
goto out;
- g_assert (parent);
hardlink_basename = hardlink_split_path->pdata[hardlink_split_path->len - 1];
+ g_assert (parent);
hardlink_source_checksum = g_hash_table_lookup (hardlink_parent->file_checksums, hardlink_basename);
if (!hardlink_source_checksum)
{
goto out;
}
+ if (g_hash_table_lookup (parent->subdirs, basename))
+ {
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "Directory exists: %s", hardlink);
+ goto out;
+ }
+
g_hash_table_replace (parent->file_checksums,
- g_strdup (hardlink_basename),
+ g_strdup (basename),
g_strdup (hardlink_source_checksum));
continue;
}
set -e
-echo "1..1"
+echo "1..4"
. libtest.sh
tar -c -z -f ../foo.tar.gz .
cd ..
-$OSTREE commit -s "from tar" -b test2 --tar foo.tar.gz
+$OSTREE commit -s "from tar" -b test-tar --tar foo.tar.gz
echo "ok tar commit"
+
+cd ${test_tmpdir}
+$OSTREE checkout test-tar test-tar-checkout
+cd test-tar-checkout
+assert_file_has_content hi hi
+assert_file_has_content hello hi
+assert_file_has_content subdir/more contents
+assert_has_file subdir/1/empty
+assert_has_file subdir/2/empty
+cd ${test_tmpdir}
+rm -rf test-tar-checkout
+echo "ok tar contents"
+
+cd ${test_tmpdir}
+mkdir hardlinktest
+cd hardlinktest
+echo other > otherfile
+echo foo1 > foo
+ln foo bar
+tar czf ${test_tmpdir}/hardlinktest.tar.gz .
+cd ${test_tmpdir}
+$OSTREE commit -s 'hardlinks' -b test-hardlinks --tar hardlinktest.tar.gz
+rm -rf hardlinktest
+echo "ok hardlink commit"
+
+cd ${test_tmpdir}
+$OSTREE checkout test-hardlinks test-hardlinks-checkout
+cd test-hardlinks-checkout
+assert_file_has_content foo foo1
+assert_file_has_content bar foo1
+echo "ok hardlink contents"